const mongoose = require("mongoose");
const messageModel = mongoose.model("message");

module.exports = {
    //获取全部
    getmessage: async () => await messageModel.find().populate(['articleId', 'userId']),
    //添加
    addlist: async (message) => await messageModel.create(message),
    delete: async (_id) => await messageModel.deleteOne({ _id }),
    search: async (find) => await messageModel.find(find).populate(['articleId', 'userId'])//通过条件id查找所有留言
}
